package com.github.shiqiyue.app.modules.dbms.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;

import com.github.shiqiyue.app.common.entity.BaseEntity;
import com.github.shiqiyue.app.common.enums.IBaseEnum;
import com.github.shiqiyue.app.modules.sys.entity.User;
import lombok.Data;

/**
 * <p>
 * 数据库-历史记录
 * </p>
 *
 * @author wenyao.wu
 * @since 2019-08-06
 */
@Data

@TableName("dbms_database_history")
public class DatabaseHistory extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /***
     * 数据库id
     */
    private Long databaseId;

    /***
     * 操作人Id
     */
    private Long userId;

    /***
     * 操作类型
     */
    private Type type;

    /***
     * 备注
     */
    private String remark;

    @TableField(exist = false)
    private User user;

    public static final String DATABASE_ID = "database_id";

    public static final String USER_ID = "user_id";

    public static final String TYPE = "type";

    public static final String REMARK = "remark";

    /***
     * 操作类型
     */
    public enum Type implements IBaseEnum {
        /***
         * 添加
         */
        ADD("添加", 1),
        /***
         * 修改
         */
        EDIT("修改", 2),
        ;

        private String name;

        private Integer value;

        Type(String name, Integer value) {
            this.name = name;
            this.value = value;
        }

        @Override
        public String getName() {
            return name;
        }

        @Override
        public Integer getValue() {
            return value;
        }

        @Override
        public String toString() {
            return value.toString();
        }
    }

}
